package vcexam;


class PingPong2 {
    synchronized void hit(long n) {
        for(int i = 1; i < 3; i++)
            System.out.print(n + "-" + i + " ");
    }
}

public class Threads2 implements Runnable {

//	@Override
//	public void run() {
//		System.out.println("run.");
//        throw new RuntimeException("Problem");
//	}
	
	
	//** Exception in thread "main" java.lang.IllegalMonitorStateException
	void waitForSignal()  {
	    Object obj = new Object();
	    synchronized (Thread.currentThread()){
	      //  obj.wait();
	        //obj.notify();
	    }
	}
	//*********************************************************************
	
	static PingPong2 pp2 =new PingPong2(); 
	
	public static void main(String[] args) {
		/* End of Method. 
		 * run.
		 * Exception in thread "Thread-0" java.lang.RuntimeException: Problem */
//		Thread t  = new Thread(new Threads2());
//		t.start();
//		System.out.println("End of Method. ");
		
		//** Exception in thread "main" java.lang.IllegalMonitorStateException
//		Threads2 th = new Threads2();
//		th.waitForSignal();

		new Thread(new Threads2()).start();
        new Thread(new Threads2()).start();
    }

    public void run() { pp2.hit(Thread.currentThread().getId()); }

	
	
}
